//------------------------------------------------------------------------------
//
//  StingerPWMDrive Types
//
//  Written Jan 2008 by Trevor Taylor, Software Technology, Australia
//
//  Implements the generic Differential Drive contract for the Stinger
//
//------------------------------------------------------------------------------

using Microsoft.Dss.Core.Attributes;
using System;
using System.Collections.Generic;

// Additional using statements
using Microsoft.Dss.Core;
using Microsoft.Ccr.Core;
using Microsoft.Dss.ServiceModel.Dssp;
using System.ComponentModel;
using W3C.Soap;

using drive=Microsoft.Robotics.Services.Drive.Proxy;


namespace ProMRDS.Robotics.Stinger.PWMDrive
{

    #region Contract

    /// <summary>
    /// StingerPWMDrive Contract
    /// </summary>
    public sealed class Contract
    {
        /// The Unique Contract Identifier for the StingerPWMDrive service
        public const String Identifier = "http://www.promrds.com/contracts/2008/01/stingerpwmdrive.html";
    }

    #endregion

    //NOTE:
    // This service does not extend the State or the Main Operations Port of the
    // Generic Differential Drive. Therefore there are no definitions here for
    // these data structures. Instead, the generic ones are used.

    #region Internal Operations

    // Additional (internal) operations

    [DataContract]
    public enum Motions
    {
        SetDrivePower,
        DriveDistance,
        RotateDegrees
    }

    [DisplayName("Execute Motion")]
    [Description("Executes a specified type of motion")]
    public class ExecuteMotion : Update<ExecuteMotionRequest, PortSet<DefaultUpdateResponseType, Fault>>
    {
        public ExecuteMotion()
        {
        }
        public ExecuteMotion(Motions move, drive.SetDrivePower sdp)
        {
            this.Body.Motion = move;
            this.Body.SetPower = sdp;
        }
    }

    [Description("Class to execute a move -- Internal")]
    //    [DataContract]
    //    [DataMemberConstructor]
    public class ExecuteMotionRequest
    {
        [DataMember]
        public drive.SetDrivePower SetPower;
        [DataMember]
        public Motions Motion;

    }

    [DisplayName("Stop Timed Motion")]
    [Description("Stops a specified motion request (if still active)")]
    public class StopMotion : Submit<StopMotionRequest, PortSet<DefaultSubmitResponseType, Fault>>
    {
        public StopMotion()
        {
        }
        public StopMotion(StopMotionRequest stop)
        {
            this.Body = stop;
        }
        public StopMotion(int num)
        {
            this.Body.AckNumber = num;
        }
    }

    [Description("Class to terminate a timed move -- Internal")]
    //    [DataContract]
    //    [DataMemberConstructor]
    public class StopMotionRequest
    {
        private int _num;

        [DataMember]
        [Description("Acknowledgement number")]
        public int AckNumber
        {
            get { return this._num; }
            set { this._num = value; }
        }
    }

    #endregion

}
